🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

tinyexec

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinyexec

A minimal library for executing processes in Node

1.0.1
latest
Source
npm
Version published
Weekly downloads
13M
6.01%
Maintainers
1
Weekly downloads
 
Created

What is tinyexec?

The tinyexec npm package is a lightweight utility for executing shell commands in Node.js. It provides a simple and efficient way to run shell commands and capture their output, making it useful for scripting and automation tasks.

What are tinyexec's main functionalities?

Execute a simple command

This feature allows you to execute a simple shell command and capture its output. In this example, the 'echo' command is used to print 'Hello, World!' to the console.

const tinyexec = require('tinyexec');

(async () => {
  const result = await tinyexec('echo Hello, World!');
  console.log(result.stdout); // Outputs: Hello, World!
})();

Capture standard error

This feature allows you to capture the standard error output of a command. In this example, an attempt to run a nonexistent command results in an error, which is then captured and printed to the console.

const tinyexec = require('tinyexec');

(async () => {
  try {
    await tinyexec('nonexistent-command');
  } catch (error) {
    console.error(error.stderr); // Outputs the error message
  }
})();

Run a command with options

This feature allows you to run a command with additional options, such as specifying the working directory. In this example, the 'ls' command lists the files in the specified directory.

const tinyexec = require('tinyexec');

(async () => {
  const result = await tinyexec('ls', { cwd: '/path/to/directory' });
  console.log(result.stdout); // Outputs the list of files in the specified directory
})();

Other packages similar to tinyexec

Keywords

execa

FAQs

Package last updated on 27 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts